#ifndef XMLCONFIG_H
#define XMLCONFIG_H

#include "pluginextension_global.h"
#include <QtCore/qglobal.h>
#include <QSettings>
#include <QDomElement>
#include <QObject>

class PLUGINEXTENSIONSHARED_EXPORT XmlConfig : public QObject
{
    Q_OBJECT
public:
    static const QSettings::Format XmlSettingsFormat;

    static bool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
    static bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);

private:
    static QString rootName;

    static void handleNode(QDomElement* node, QSettings::SettingsMap &map, QString path = "");
    static QSettings::SettingsMap settingsToMap(QSettings& qs);
    static QString variantToString(const QVariant &v);
    static QVariant stringToVariant(const QString &s);
    static QStringList splitArgs(const QString &s, int idx);

};

#endif // XMLCONFIG_H
